package regexp

import (
	"fmt"
	"regexp"
)

// 手机号脱敏
// https://blog.csdn.net/sphinx1122/article/details/86360427
func mobileDesensitization(mobile string) string {
	compile, e := regexp.Compile(`^(132)(\d{4})(\d{4})$`)
	if e != nil {
		panic("something is wrong")
	}
	replaced := compile.ReplaceAllString("13253503652", "${1}****${3}")
	fmt.Println(replaced)
	//strings.Replace()

	match := compile.MatchString(mobile)
	if match {
		fmt.Println("ok")
	} else {
		fmt.Println("not ok")
	}
	return ""
}
